<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>APL材料用量查询</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta content="no-cache, no-store, must-revalidate" http-equiv="Cache-Control"/>
    <meta content="no-cache" http-equiv="Pragma"/>
    <meta content="0" http-equiv="Expires"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=8">
    <meta http-equiv="Expires" content="0">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-control" content="no-cache">
    <meta http-equiv="Cache" content="no-cache">
    <link rel="stylesheet" href="../../styles/base.css"/>
    <link rel="stylesheet" href="../../styles/common.css"/>
    <link rel="stylesheet" href="../../styles/font/iconfont.css"/>
    <link rel="stylesheet" href="../../styles/pages/tabs.css"/>
    <link rel="stylesheet" href="../../jqueryNicepage/css/layui.css"  media="all">
    <link rel="stylesheet" href="../../styles/pages/calendar.css">
    <link rel="stylesheet" href="../../styles/jquery.multiselect.css"/>
    <style>
		.datagrid .panel-body {
			overflow: hidden;
			position: relative;
		}
        .queryCondition #dd{
            left:50px;
            top:0px;
        }
        .queryCondition{
            width:100%;
            min-height:180px;
            line-height: 30px;
            margin-top: 10px;
            padding-bottom: 10px;
            height:auto;
            border-bottom:2px solid #ccc;
        }
        .queryCondition span{
            display: inline-block;
             margin-top: ;
        }
        .boxContainer {
            background: #fff;
            border:none;
            box-sizing: border-box;
            width: 100%;
            top: 5px;
            border-bottom: 0;
            left: 10px;
            height: 98%;
            /*position:relative;*/
			position:fixed
        }
        
        .ctrBtn{
			text-align: right;
			margin-top: 20px;
			margin-right:10px;
		}
        .ctrBtn button {
			display: inline-block;
			margin: 0 5px 5px 5px;
			line-height: 30px;
			padding: 0 10px;
			cursor: pointer;
		}
		.folder:hover, .clearBtn:hover, .searchSureBtn:hover, .toExcell:hover{
            color:#fff;
            background:#40E0D0;
        }
		
		a {
			color:blue
		}
        
        /**
        	newText:文本框的样式
        	newSelect:选择框的样式
        */
        .newText, .newSelect {
        	color:#666;
            height: 38px;
            width: 150px;
            padding: 0 6px;
            border: 1px solid #ccc;
            box-sizing: border-box;
            font-size: 14px;
            outline: none;
            line-height: 38px;
        }
        
        .pro_kvs2{float: right;width: 100%; color:#666}
		.pro_kvs2 .pro_kv{float: left;width: 25%;height: 37px;line-height: 27px;margin-bottom: 5px;padding: 5px; box-sizing:border-box;}
		.pro_kvs2 .pro_k{text-align: right;float: left;width: 25%;height: 100%;line-height: 27px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;word-wrap: normal;}
        .pro_v{text-align: left;float: left;width: 70%;height: 100%;line-height: 27px;}
        .pro_d{text-align: left;float: left;width: 5%;height: 100%;line-height: 27px;}
    </style>

</head>
<body>
<div class="boxContainer" id='aplQuantity'>
    <div id="loading">
        <img src='../../styles/img/loading.gif' />
    </div>
    <div class="bgClassBox">
		<div class="queryCondition">
			<form class="layui-form" action="">
				<div class="pro_kvs2">
					<div class="pro_kv">
						<div class="pro_k" id="lab3" title="APL材料号">
							<span class="required2"></span>APL材料号
						</div>
						<div class="pro_d">：</div>
						<div class="pro_v">
							<input class="layui-input" type="text" id="aplPartNumber" placeholder="请输入APL材料号" lay-filter="aplPartNumber"></input>
						</div>
					</div>
					
					<div class="pro_kv">
						<div class="pro_k" id="lab3" title="材料型号">
							<span class="required2"></span>材料型号
						</div>
						<div class="pro_d">：</div>
						<div class="pro_v">
							<input class="layui-input" type="text" id="MaterialType" placeholder="请输入材料型号" lay-filter="MaterialType"></input>
						</div>
					</div>
					
					<div class="pro_kv">
						<div class="pro_k" id="lab6" title="使用范围">
							<span class="required2"></span>使用范围
						</div>
						<div class="pro_d">：</div>
						<div class="pro_v">
							<select class="newSelect" id='usableRange' >
								 <option value="">请选择使用范围</option>
							</select>
						</div>
					</div>
					
					<div class="pro_kv">
						<div class="pro_k" id="lab7" title="等级">
							<span class="required2"></span>等级
						</div>
						<div class="pro_d">：</div>
						<div class="pro_v">
							<select class="newSelect" id='level' >
								<option value="">请选择等级</option>
							</select>
						</div>
					</div>
					
					<div class="pro_kv">
						<div class="pro_k" id="lab8" title="状况">
							<span class="required2"></span>状况
						</div>
						<div class="pro_d">：</div>
						<div class="pro_v">
							<select class="newSelect" id='status' >
							 	<option value="">请选择状况</option>
								<option value="正常">正常</option>
								<option value="异常">异常</option>
							</select>
						</div>
					</div>
					<div class="pro_kv">
						<div class="pro_k" id="lab10" title="责任人">
							<span class="required2"></span>责任人
						</div>
						<div class="pro_d">：</div>
						<!--<div class="pro_v">
							<select name="owner" id="owner" lay-verify="" lay-search class="newSelect" lay-filter="owner">
								<option value="">请选择责任人</option>
							</select>
						</div>-->
							<div class="layui-input-block" name="single_select" style="margin-left:100px">
								<div class="layui-form-select" style="width: 230px"> <!-- 将值作为下拉样式展示-->
									<div class="layui-select-title">
										<input type="text" class="layui-input" placeholder="请输入至少5个字符"
											   name="owner" id="owner" autocomplete="off" id="">
										<i class="layui-edge"></i>
									</div>
									<dl name="select_show" class="layui-anim layui-anim-upbit">
										<dd lay-value="" class="layui-select-tips" style="text-align: center">
											<i class="layui-icon layui-icon-loading layui-icon layui-anim layui-anim-rotate layui-anim-loop"></i>
										</dd>
									</dl>
								</div>
							</div>
					</div>
				</div>
			</form>
			
			
			<div class="pro_kvs2" >
				<div class="ctrBtn">
					<button class="searchSureBtn">搜索</button>
					<button class="clearBtn">重置</button>
					<button class="toExcell">导出Excel</button>
				</div>
			</div>

			<div style="clear: both"></div>
			<table id="showTable"></table>
			
			<table id="demo" lay-filter="test"></table>
		</div>
    </div>
</div>
<script type="text/javascript" src="../../js/jquery-1.11.3.min.js"></script>
<script src="../../js/json2.js"></script>
<script src="../../js/common/publicClass.js"></script>
<script src="../../layer/layer.js" charset="utf-8"></script>
<script type="text/javascript" src="../../js/constants/calendar.js"></script>
<script type="text/javascript" src="../../js/common/utils.js"></script>
<script type="text/javascript" src="../../js/common/myAjax.js"></script>
<script language="Javascript" src="../../jqueryNicepage/js/layui.js"></script>
<script type="text/javascript" src="../../js/common/jquery-ui.min.js"></script>
<script type="text/javascript" src="../../js/common/jquery.multiselect.js"></script>
<script type="text/javascript" src="../../js/pages/dccQuery/selects.js"></script>
<script type="text/javascript" src="/Windchill/netmarkets/jsp/ext/BOMECO/tianma/materialPages/APL/APLQuantity.js"></script>

<script type="text/javascript" src="../../laydate/laydate.js"></script>

<script>
	
	 $(window).load(function(){
		
        //加载表格
        fetchData();
        //使用范围
        showSelect("/QuantityController/findQuantity", "usableRange");
        //等级
        showEnumerateSelect("Level","level");

        //导出
        $(".toExcell").click(function(){
            var data = setSearchCondition();
            MaterialReverseAjax2("/QuantityController/export",JSON.stringify(data),function(str){
                if(str.path!=undefined&&str.path!=""){
                    window.location.href=str.path;
                } else {
					layer.alert(
						'暂未查询到数据，无法导出', 
						{icon: 2} // 1\2\3
					);
				}
            })
        });
        
        //重置
        $(".clearBtn").click(function(){
        	$(":input").val("");//清除所有文本框的值
        });
		
		//搜索
		$('.searchSureBtn').click(function(){
			fetchData();
		});
		
		searchUser();
	});

function fetchData() {
	layui.use('table', function(){
		var table = layui.table;
		var data = setSearchCondition();
		
		//动态表格
		table.render({
			elem: '#demo',
			height: 350,
			url:'/Windchill/app/QuantityController/queryQuantity',
			/*page: true, //开启分页
			limit:5,
			limits:[5,10,20],*/
			where:{
				params:JSON.stringify(data)
			},
			text:'暂无数据',
			//toolbar:true, //工具栏
			cols: [[ //表头
				{field: 'oid', title: 'ID', hide:true},
				{field: 'id', title: '序号', sort: true, fixed: 'left', width:'10%'},
				{field: 'name', title: 'APL材料', sort: true, width:'15%'},
				{field: 'number', title: '编号', sort: true, width:'10%'},
				{field: 'MaterialType', title: '材料型号', sort: true, width:'10%'},
				{field: 'range', title: '使用范围', sort: true, width:'15%'},
				{field: 'quantity', title: 'ERP用量', sort: true, width:'10%'} ,
				{field: 'level', title: '等级', sort: true, width:'10%'},
				{field: 'status', title: '状况', sort: true, width:'10%'},
				{field: 'owner', title: '负责人', sort: true, width:'10%'}
			]]
		});
	});
}
	
</script>
</body>
</html>